package com.fujitsu.nanjing.tieba.dao;

import com.fujitsu.nanjing.tieba.ibator.CoreSection;
import com.fujitsu.nanjing.tieba.ibator.CoreSectionCriteria;
import java.util.List;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

public class CoreSectionDAOImpl extends SqlMapClientDaoSupport implements CoreSectionDAO {

    public CoreSectionDAOImpl() {
        super();
    }

    public int countByExample(CoreSectionCriteria example) {
        Integer count = (Integer)  getSqlMapClientTemplate().queryForObject("core_section.countByExample", example);
        return count;
    }

    public int deleteByExample(CoreSectionCriteria example) {
        int rows = getSqlMapClientTemplate().delete("core_section.deleteByExample", example);
        return rows;
    }

    public int deleteByPrimaryKey(Integer sectionid) {
        CoreSection _key = new CoreSection();
        _key.setSectionid(sectionid);
        int rows = getSqlMapClientTemplate().delete("core_section.deleteByPrimaryKey", _key);
        return rows;
    }

    public Integer insert(CoreSection record) {
        Object newKey = getSqlMapClientTemplate().insert("core_section.insert", record);
        return (Integer) newKey;
    }

    public Integer insertSelective(CoreSection record) {
        Object newKey = getSqlMapClientTemplate().insert("core_section.insertSelective", record);
        return (Integer) newKey;
    }

    @SuppressWarnings("unchecked")
    public List<CoreSection> selectByExample(CoreSectionCriteria example) {
        List<CoreSection> list = getSqlMapClientTemplate().queryForList("core_section.selectByExample", example);
        return list;
    }

    public CoreSection selectByPrimaryKey(Integer sectionid) {
        CoreSection _key = new CoreSection();
        _key.setSectionid(sectionid);
        CoreSection record = (CoreSection) getSqlMapClientTemplate().queryForObject("core_section.selectByPrimaryKey", _key);
        return record;
    }

    public int updateByExampleSelective(CoreSection record, CoreSectionCriteria example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("core_section.updateByExampleSelective", parms);
        return rows;
    }

    public int updateByExample(CoreSection record, CoreSectionCriteria example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("core_section.updateByExample", parms);
        return rows;
    }

    public int updateByPrimaryKeySelective(CoreSection record) {
        int rows = getSqlMapClientTemplate().update("core_section.updateByPrimaryKeySelective", record);
        return rows;
    }

    public int updateByPrimaryKey(CoreSection record) {
        int rows = getSqlMapClientTemplate().update("core_section.updateByPrimaryKey", record);
        return rows;
    }

    protected static class UpdateByExampleParms extends CoreSectionCriteria {
        private Object record;

        public UpdateByExampleParms(Object record, CoreSectionCriteria example) {
            super(example);
            this.record = record;
        }

        public Object getRecord() {
            return record;
        }
    }
}